package com.itmk.web.goods_report.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itmk.web.goods_report.entity.GoodsReport;
import com.itmk.web.goods_report.entity.ReportParm;
import com.itmk.web.goods_report.entity.ReportVo;
import com.itmk.web.goods_report.mapper.GoodsReportMapper;
import com.itmk.web.goods_report.service.GoodsReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 山顶洞人郑某
 * @className GoodsReportServiceImpl.java
 * @date 2023 12 11
 */
@Service
public class GoodsReportServiceImpl extends ServiceImpl<GoodsReportMapper, GoodsReport> implements GoodsReportService {
    @Autowired
    GoodsReportMapper goodsReportMapper;
    @Override
    public IPage<ReportVo> getList(ReportParm parm) {
        IPage<ReportVo> page = new Page<>(parm.getCurrentPage(),parm.getPageSize());
        return goodsReportMapper.getList(page);
    }

    @Override
    public Long maxID() {
       long id =  goodsReportMapper.maxId()+1;
       this.baseMapper.updateMaxId(id+1);
       return id;
    }
}
